import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'
import './index.css'
import App from './App.tsx'

document.addEventListener('deviceready', onDeviceReady, false);

function onDeviceReady() {
  // Cordova is now initialized. Have fun!
  console.log('Running cordova-' + cordova.platformId + '@' + cordova.version);
}

// 根据环境变量控制eruda
console.log(`🌍 APP_ENV: ${process.env.APP_ENV}`)
if (process.env.APP_ENV !== 'prod') {
  import('eruda').then((eruda) => {
    eruda.default.init();
  });
}

createRoot(document.getElementById('root')!).render(
  <StrictMode>
    <App />
  </StrictMode>,
)
